package com.baidu.day01;

import java.util.Scanner;

public class Test01 {
    public static void main(String[] args) {

        while (true) {
            System.out.println("=========欢迎光临品兴银行=========");
            System.out.println("请输入你要进行的操作:  1.查看余额 2.存钱 3.取钱 4.退出系统 ");
            double balance = 10000;
            Scanner sc = new Scanner(System.in);
            int userInput = sc.nextInt();
            switch (userInput) {
                case 1:
                    System.out.println("余额为：" + balance);
                    break;
                case 2:
                    System.out.println("请输入要存的钱数：");
                    double money1 = sc.nextDouble();
                    if (money1 < 0) {
                        System.out.println("您输入的金额不合法");
                    } else {
                        balance += money1;
                        System.out.println("当前的余额为" + balance);
                    }
                    break;
                case 3:
                    System.out.println("请输入要取的钱数：");
                    double money2 = sc.nextDouble();
                    if (money2 < 0 || money2 > balance) {
                        System.out.println("您输入的金额不合法");
                    } else {
                        balance -= money2;
                        System.out.println("当前的余额为" + balance);
                    }
                    break;
                case 4:
                    System.out.println("欢迎下次光临");
                    return;


            }
        }


    }


}
